package com.gu.enumeration.vehicleTypeEnum;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: gusongliao
 * @Description: 车辆类型枚举
 * @createDate 2023/01/07 23:03
 */
public enum VehicleTypeEnum {
    OFFICIAL("公务","OFFICIAL_DATA_OPERATOR"),
    POWER_SUPPLY_STATION("供电所","POWER_SUPPLY_STATION_DATA_OPERATOR"),
    AGRICUL_ELECTRICITY("农电","AGRICUL_ELECTRICITY_DATA_OPERATOR"),
    PRODUCTION("生产","PRODUCTION_DATA_OPERATOR")
    ;

    // 车辆类型
    private String vehicleType;
    // 车辆类型对应全局参数名称
    private String vehicleTypeSettingOperatorName;

    VehicleTypeEnum(String vehicleType, String vehicleTypeSettingOperatorName) {
        this.vehicleType = vehicleType;
        this.vehicleTypeSettingOperatorName = vehicleTypeSettingOperatorName;
    }

    public String getVehicleType() {
        return vehicleType;
    }

    public void setVehicleType(String vehicleType) {
        this.vehicleType = vehicleType;
    }

    public String getVehicleTypeSettingOperatorName() {
        return vehicleTypeSettingOperatorName;
    }

    public void setVehicleTypeSettingOperatorName(String vehicleTypeSettingOperatorName) {
        this.vehicleTypeSettingOperatorName = vehicleTypeSettingOperatorName;
    }

    public static List<VehicleTypeEnum> getVehicleTypeEnum() {
        List<VehicleTypeEnum> vehicleTypeEnumList = new ArrayList<>();
        vehicleTypeEnumList.add(OFFICIAL);
        vehicleTypeEnumList.add(POWER_SUPPLY_STATION);
        vehicleTypeEnumList.add(AGRICUL_ELECTRICITY);
        vehicleTypeEnumList.add(PRODUCTION);
        return vehicleTypeEnumList;
    }

    public static String getMatchVehicleTypeByParam(String vehicleTypeSettingOperatorName) {
        for (VehicleTypeEnum value : VehicleTypeEnum.values()) {
            if (value.getVehicleTypeSettingOperatorName().equals(vehicleTypeSettingOperatorName)) {
                return value.getVehicleType();
            }
        }
        return "";
    }
}
